package org.jackysoft.data;

import java.io.FileNotFoundException;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import javax.servlet.http.Part;

import org.jackysoft.entity.base.BaseOption;
import org.jackysoft.entity.base.RootEntity;
import org.jackysoft.query.Order;
import org.jackysoft.query.RunnerQuery;
import org.jackysoft.util.FileDownload;
import org.jackysoft.util.Page;
import org.jackysoft.ztree.ZTreeNode;

public interface ServiceProvider<T extends RootEntity> {
	T find(String id);
	List<T> findAll();
	List<T> findAll(int start, int size);
	List<T> queryAll(RunnerQuery query);
	void remove(T t);
	void remove(String id);
	void remove(Collection<T> bs);
	void removeAll() ;
	void save(T t);
	void saveOrUpdate(T b);
	void save(Collection<T> ts);
	void update(T t);
	void update(Collection<T> bs);
	void update(String id, Map<String,Object> ps) ;
	void update(long id, Map<String,Object> ps) ;
	void update(int id, Map<String,Object> ps) ;
	T queryOne(RunnerQuery query);
	Page query(RunnerQuery mqc, int start, int rows);
	Page query(RunnerQuery query, Order sort, int start, int size);
	Page query(RunnerQuery query);
	Page pager(int start, int rows);
	int count();
	int count(RunnerQuery qc);
	void upload(Part file,T bean);
	void uploads(Part[] files, List<T> beans);
	FileDownload download(String id) throws FileNotFoundException;
	Collection<ZTreeNode> ztree(String id);
	Collection<BaseOption> getOptions(RunnerQuery query);
	void doOrder(Collection<T> beans);
}
